package com.aaa.ssm.controller;

import com.aaa.ssm.entity.TSbsnOrder;
import com.aaa.ssm.service.PayService;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;


@RestController
@RequestMapping("pay")
public class PayController extends BaseController {

    @Resource
    private PayService payService;

    /**
     * 生成二维码
     * @param order
     * @return
     */
    @PostMapping("getNativeCodeUrl")
    public Result getNativeCodeUrl(@RequestBody TSbsnOrder order){
        Map map=payService.getNativeByOrder(order);
        return success(map);
    }

    /**
     * 获取支付状态
     * @param orderNo
     * @return
     */
    @GetMapping("getPayStatus/{orderNo}")
    public Result getPayStatus(@PathVariable("orderNo") String orderNo)   {
        Map<String, String> map = payService.getPayStatus(orderNo);
        return success(map);
    }

}
